/*
 * @FilePath: \undefinedc:\Users\sxjct\.leetcode\78.子集.cpp
 * @Brief: 
 * @Version: 1.0
 * @Date: 2021-03-22 13:55:56
 * @Author: tianyiyi
 * @Copyright: Copyright@tianyiyi
 * @LastEditors: Mr.Tian
 * @LastEditTime: 2021-03-22 14:06:38
 */
/*
 * @lc app=leetcode.cn id=78 lang=cpp
 *
 * [78] 子集
 */

// @lc code=start
class Solution {
private:
    vector<vector<int>> res;
public:
    vector<vector<int>> subsets(vector<int>& nums) {
        vector<int> path;
        backtrack(nums,path,0);
        return res;
    }

    void backtrack(vector<int>&nums , vector<int> &path , int start)
    {
        res.push_back(path);
        for(int i=start ; i < nums.size(); i++)
        {
            path.push_back(nums[i]);                // 做出选择
            backtrack(nums,path,i+1);               // 在选择中继续递归，标识下一个选择列表的开始位置，i+1
            path.pop_back();                        // 撤销选择
        }
    }
};
// @lc code=end

